﻿using AutoMapper;
using rbac.Contracts.DTO.Input;
using rbac.Contracts.DTO.Output;
using rbac.Domain.Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace rbac.Contracts
{
    /// <summary>
    /// 将实体类与DTO类建立映射关系
    /// </summary>
    public class rbacProfile:Profile
    {
        public rbacProfile()
        {
            //将User类与UserOutput映射上
            CreateMap<User,UserOutput>();
            CreateMap<Permission, PermissOutput>();
            CreateMap<Role,RoleOutput>();
            CreateMap<RoleInput, Role>();
            CreateMap<PerInput, Permission>();
            CreateMap<PermissInput, Permission>();
            CreateMap<Permission, PermissionDto>().ForMember(p=>p.PermissionId,opt=>opt.MapFrom(src=>src.Id));
        }
    }
}
